From: Juergen Gross Date: Fri, 8 Jun 2018 09:51:12 +0000 (+0200) Subject: tools/libxencall: enforce proper alignment of hypercall buffers X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~3632 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=f5d10dc2909c84e4ffc7240e542c513ed480aa04;p=xen.git tools/libxencall: enforce proper alignment of hypercall buffers xencall_alloc_buffer() is used throughout Xen tools for allocating hypercall buffers. Allocation is done at page granularity. For simple administration each allocated set of pages contains a small header holding the number of pages of that set. The hypercall buffer is located directly after the 4 byte sized header, leading to a wrong alignment for e.g. pointers. Repair that by using a 16 byte sized header enforcing the same alignment as malloc(). Signed-off-by: Juergen Gross Acked-by: Wei Liu --- diff --git a/tools/libs/call/buffer.c b/tools/libs/call/buffer.c index 2d8fc29ac6..0b6af2db60 100644 --- a/tools/libs/call/buffer.c +++ b/tools/libs/call/buffer.c @@ -151,6 +151,7 @@ void xencall_free_buffer_pages(xencall_handle *xcall, void *p, size_t nr_pages) struct allocation_header { int nr_pages; + int pad[3]; }; void *xencall_alloc_buffer(xencall_handle *xcall, size_t size)